using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;

namespace HogBlog.Models
{
    public class HogBlogContext : DbContext
    {
        // You can add custom code to this file. Changes will not be overwritten.
        // 
        // If you want Entity Framework to drop and regenerate your database
        // automatically whenever you change your model schema, add the following
        // code to the Application_Start method in your Global.asax file.
        // Note: this will destroy and re-create your database with every model change.
        // 
        // System.Data.Entity.Database.SetInitializer(new System.Data.Entity.DropCreateDatabaseIfModelChanges<HogBlog.Areas.Admin.Models.HogBlogContext>());

        public DbSet<HogBlog.Models.Tag> Tags { get; set; }

        public DbSet<HogBlog.Models.Entry> Entries { get; set; }
    }

    public class HogBlogDbInitiliser : System.Data.Entity.DropCreateDatabaseIfModelChanges<HogBlog.Models.HogBlogContext>
    {
        protected override void Seed(HogBlog.Models.HogBlogContext context)
        {
            base.Seed(context);

            var Entries = new List<Entry>
            {
                new Entry {
                    EntryId = 1,
                    Title = "First Post!",
                    Content = "This is the first post",
                    Status = 1,
                    PubDate = DateTime.Now
                },
                new Entry {
                    EntryId = 2,
                    Title = "Boobies!!",
                    Content = "This is the Boobies post",
                    Status = 1,
                    PubDate = DateTime.Now
                }
            };

        }
    }
}